package connect_to_database;

import java.util.Scanner;

public class validation {
    public static void main(String[] args) {
        int id = 0;
        String name = "";
        double weight =0.0;
        String birthday = "";
        connection c = new connection();
        Scanner scanner = new Scanner(System.in);
        System.out.println("Inset（新增数据）\nDelete（删除数据）\nCheck（查询数据）\nUpdate（更新数据）\n请输入你需要的操作：");

        while(scanner.hasNextLine()){
            String n = scanner.nextLine();
            if(n.equals("Delete")){
                id = scanner.nextInt();
                c.Delete(id);
            }else if(n.equals("Inset")){
                id = scanner.nextInt();
                name = scanner.next();
                weight = scanner.nextDouble();
                birthday = scanner.next();
                c.Inset(id,name,weight,birthday);
            }else if(n.equals("Check")){
                c.Check();
            }else if(n.equals("Update")){
                id = scanner.nextInt();
                name = scanner.next();
                weight = scanner.nextDouble();
                birthday = scanner.next();
                c.Update(id,name,weight,birthday);
            }else{
                System.out.println("请合理输入操作名称！！！");
                break;
            }
        }


    }
}
